<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@page import="jobhunter.model.enums.ActionState"%>
<%@page import="jobhunter.model.enums.ActionType"%>
<%@page import="jobhunter.model.enums.CommunicationType"%>
<!DOCTYPE html >
<html>
<head>
<title>Job Hunter - ajouter action</title>
</head>
<body>


	<div id="breadcrumb">
		<a href="/main" >accueil</a> >
		<a href="/actionsList" >actions</a>
		> ajout
	</div>
	<form action="addActionValidate" method="post">
		<h1>Action Form</h1>
		<c:choose>
			<c:when test="${process != null}">
				<input type="hidden" name="processId" value="${process.id }" />
				<c:choose>
					<c:when test="${company != null}">
						<h2>For Company : ${company.name }</h2>
						<input type="hidden" name="companyId" value="${company.id }" />
						<input type="hidden" name="page" value="company" />
					</c:when>
					<c:otherwise>
						<h2>For Process : ${process.name }</h2>
						<input type="hidden" name="page" value="process" />
					</c:otherwise>
				</c:choose>
			</c:when>
			<c:when test="${contact != null}">
				<h2>For Contact : ${contact.fullName }</h2>
				<input type="hidden" name="contactId" value="${contact.id }" />
				<input type="hidden" name="page" value="contact" />
			</c:when>
		</c:choose>


		<c:if test="${process == null}">
			<div>
				<label>Process : </label> <select name="processId">
					<c:forEach items="${processes}" var="process">
						<option value="${process.id}"
							<c:if test="${process.id == action.process.id }">selected="selected"</c:if>>${process.name}</option>
					</c:forEach>
				</select>
			</div>
		</c:if>

		<c:if test="${contact == null}">
			<div>
				<label>Contact : </label> <select name="contactId">
					<c:forEach items="${contacts}" var="contact">
						<option value="${contact.id}">${contact.firstName}
							${contact.lastName }</option>
					</c:forEach>
				</select>
			</div>
		</c:if>

		<div>
			<label>Name : </label><input type="text" name="name" />
		</div>
		<div>
			<label>realized : </label><input type="number" name="realized" />
		</div>
		<div>
			<label>motivationLettre : </label><input type="text"
				name="motivationLettre" />
		</div>
		<div>
			<label>cv : </label><input type="text" name="cv" />
		</div>

		<div>
			<div><label>description : </label></div>
			<textarea name="description" value="${action.description}" rows="10" cols="100"></textarea>
		</div>
		<div>
			<label>actionType : </label> <select name="actionType">
				<c:forEach items="<%=ActionType.values()%>" var="actionType">
					<option value="${actionType}">${actionType}</option>
				</c:forEach>
			</select>
		</div>
		<div>
			<label>state : </label> <select name="actionState">
				<c:forEach items="<%=ActionState.values()%>" var="state">
					<option value="${state}">${state}</option>
				</c:forEach>
			</select>
		</div>
		<div>
			<label>communicationType : </label> <select name="communicationType">
				<c:forEach items="<%=CommunicationType.values()%>"
					var="communicationType">
					<option value="${communicationType}">${communicationType}</option>
				</c:forEach>
			</select>
		</div>

		<div>
			<input type="submit" />
		</div>
	</form>
</body>
</html>